(function () {
    document.addEventListener('mousedown', function(e) {
        var et = e.target,
            lc = -1;
        while (et && !(et instanceof HTMLAnchorElement) && (3 > lc++))
            et = et.parentElement;
        if (!et || !et.href)
            return;
        var link = et;
        e.stopPropagation();
            if (link.pathname === '/url') {
                if ((/[?&]url=[^&]+/).test(link.search)) {
                    link.href = decodeURIComponent(link.search.split(/[?&]url=/)[1].split('&')[0]);
                    console.log('Link changed to', link.href);
                }
            } else {
                // console.log('Link changed to', link.href);
            };
    }, false);
})();